/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package entity;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;

/**
 *
 * @author 51436342
 */
public class Movie {

    private String name;
    private int id;
    private String genre;
    private String opendate;
    private String language;
    private String actor;
    private String StoryLine;
    private int duration;
    private ArrayList<Integer> sessionArr=new ArrayList<Integer>();
    static ArrayList<Movie> movieList=new ArrayList<Movie> ();

    public Movie() {
        
        //get info from database;

    }

    public Movie(int id,String name,int duration , String genre, String opendate, String language, String actor, String storyLine) {
        this.name=name;
        this.id=id;
        this.genre=genre;
        this.opendate=opendate;
        this.language=language;
        this.actor=actor;
        this.StoryLine=storyLine;
        this.duration=duration;
        movieList.add(this);
    }

    public void addSession(int sessionId) {
        this.sessionArr.add(sessionId);
    }

    public Integer[] getAllSessions() {
        int arrSize=sessionArr.size();
        if(arrSize==0)
            return null;
        Integer[] sessionId=new Integer[arrSize];
        for(int i=0;i<arrSize;i++)
            sessionId[i]=sessionArr.get(i);
        return sessionId;
    }

    public String getMovieName() {
        return this.name;
    }

    public void setMovieName(String name) {
        this.name=name;
    }
    
    public Movie getMovieById(int movieId)
    {
        for(int i=0;i<movieList.size();i++)
        {
            if (movieList.get(i).equals(movieId))
                return movieList.get(i);
        }
        
        return null;
    }

    public int getMovieId() {
        return this.id;
    }
    
    public void setMovieId(int id) {
        this.id=id;
    }



}
